﻿//
// Created by 50177 on 2019/7/10.
//

#ifndef OCTGUI_RESPONSE_H
#define OCTGUI_RESPONSE_H

#include "qglobal.h"
#include "include/commonconst.h"

#include <QMetaType>

class Response {
public:
    enum Type {
        NoResponse = 0,
        ACK = 1,
        Query_Motor_Result = 2,
        Query_Board_Version_Result = 3,
    };
public:
    //--added by qinyaning 202007131436
    Response();
    //--
    //--added by qinyaning 202007141033
    void InitParams();
    //--
    Response(IN Type type);

    //--added by qinyaning 202007131849
    void SetType(IN Type type) {
        this->type = type;
    }
    //--

    void setMotorResult(IN double result) {
        queryMotorResult = result;
    }

    void setLightResult(IN int result) {
        queryLightResult = result;
    }

    double getMotorResult() const {
        return queryMotorResult;
    }

    int getLightResult() const {
        return queryLightResult;
    }

    void setExecuted(IN bool executed) {
        this->executed = executed;
    }

    bool getExecuted() const {
        return executed;
    }

    void setMajorVersion(IN quint8 version) {
        majorVersion = version;
    }

    void setMinorVersion(IN quint8 version) {
        minorVersion = version;
    }

    void setPatchVersion(IN quint8 version) {
        patchVersion = version;
    }

private:
    Type type;
    double queryMotorResult=-1;
    bool executed = false;
    int queryLightResult;
    quint8 majorVersion;
    quint8 minorVersion;
    quint8 patchVersion;
};
Q_DECLARE_METATYPE(Response)
#endif //OCTGUI_RESPONSE_H
